package com.tjetc.controller;
import com.tjetc.domain.FollowClinic;
import com.tjetc.service.FollowClinicService;
import com.tjetc.service.impl.FollowClinicServiceImpl;
import com.tjetc.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
* (follow_clinic)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/follow_clinic")
public class FollowClinicController {
/**
* 服务对象
*/
@Resource
private FollowClinicService followClinicService;

/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectOne")
public FollowClinic selectOne(Integer id) {
return followClinicService.selectByPrimaryKey(id);
}
    @GetMapping("isFollow")
    public Result isFollow(@RequestParam("phone") String phone, @RequestParam("cid") Integer cid) {
        return followClinicService.isFollow(phone,cid);
    }
    @GetMapping("follow")
    public Result follow(@RequestParam("phone") String phone, @RequestParam("cid") Integer cid) {
        return followClinicService.follow(phone,cid);
    }
    @GetMapping("cancelFollow")
    public Result cancelFollow(@RequestParam("phone") String phone, @RequestParam("cid") Integer cid) {
        return followClinicService.cancelFollow(phone,cid);
    }

    @GetMapping("selectFollowClinicInfo")
    public Result selectFollowClinicInfo(@RequestParam("uid") Integer uid) {

        return followClinicService.selectFollowClinicInfo(uid);
    }


    @GetMapping("deleteByPrimaryKey")
    public Result deleteByPrimaryKey(@RequestParam("id") Integer id) {

        return followClinicService.deleteByPrimaryKey(id)==1?Result.ok():Result.fail("删除失败");
    }

}
